#include "StdAfx.h"
#include "ListHeaderUI.h"
#include "BlueRenderEngineUI.h"

CListHeaderUI::CListHeaderUI(void)
{
	SetInset(CStdSize(0, 0));
}

CListHeaderUI::~CListHeaderUI(void)
{
}

LPCTSTR CListHeaderUI::GetClass() const
{
	return _T("ListHeaderUI");
}

LPVOID CListHeaderUI::GetInterface(LPCTSTR pstrName)
{
	if( _tcscmp(pstrName, _T("ListHeader")) == 0 ) return this;
	return CHorizontalLayoutUI::GetInterface(pstrName);
}

SIZE CListHeaderUI::EstimateSize(SIZE /*szAvailable*/)
{
	return CStdSize(0, 6 + m_pManager->GetThemeFontInfo(UIFONT_NORMAL).tmHeight);
}

void CListHeaderUI::DoPaint(HDC hDC, const RECT& rcPaint)
{
	// Draw background
	COLORREF clrBack1, clrBack2;
	m_pManager->GetThemeColorPair(UICOLOR_HEADER_BACKGROUND, clrBack1, clrBack2);
	RECT rcDraw = m_rcItem;
	rcDraw.top -= 5;
	rcDraw.bottom += 5;

	CBlueRenderEngineUI::DoPaintFrame(hDC, m_pManager, rcDraw, UICOLOR_HEADER_BORDER, UICOLOR_HEADER_BORDER, UICOLOR_HEADER_BACKGROUND, 0);
	RECT rcBottom = { rcDraw.left + 1, rcDraw.bottom - 3, rcDraw.right - 1, rcDraw.bottom };
	CBlueRenderEngineUI::DoPaintGradient(hDC, m_pManager, rcBottom, clrBack1, clrBack2, true, 4);
	//CBlueRenderEngineUI::DoPaintFrame(hDC, m_pManager, m_rcItem, UICOLOR_HEADER_BORDER, UICOLOR_HEADER_BORDER, UICOLOR_HEADER_BACKGROUND, 0);
	//RECT rcBottom = { m_rcItem.left + 1, m_rcItem.bottom - 3, m_rcItem.right - 1, m_rcItem.bottom };
	//CBlueRenderEngineUI::DoPaintGradient(hDC, m_pManager, rcBottom, clrBack1, clrBack2, true, 4);
	// Draw headers too...
	CHorizontalLayoutUI::DoPaint(hDC, rcPaint);
}